package com.kuang.thread.state;

public class TestJoin implements Runnable{

    public static void main(String[] args) throws InterruptedException {
//启动线程
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();

        for (int i = 0; i < 10; i++) {
            if (i==8){
                thread.join();
            }
            System.out.println("main"+i);
        }

    }

    //测试join方法，类似插队
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("Vip插队"+i);
        }
    }
}
